package com.xinhe.web.vo;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;

@ApiModel(description = "系统用户角色保存对象")
public class UserRoleModel {
    @ApiModelProperty("关联用户")
    @NotBlank
    private Long userId;

    @ApiModelProperty("关联角色")
    @NotEmpty
    private Set<Long> roleIds;

    public UserRoleModel() {
    }

    public UserRoleModel(@NotBlank Long userId, Long... roleIds) {
        this.userId = userId;
        this.roleIds = new HashSet<>(Arrays.asList(roleIds));
    }

    public UserRoleModel(@NotBlank Long userId, @NotEmpty Set<Long> roleIds) {
        this.userId = userId;
        this.roleIds = roleIds;
    }

    public Set<Long> getRoleIds() {
        return this.roleIds;
    }

    public void setRoleIds(Set<Long> roleIds) {
        this.roleIds = roleIds;
    }

    public Long getUserId() {
        return this.userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

}
